package com.iuie.ns.devtools.element;

import java.util.List;

import com.iuie.ns.frame.utils.StringUtils;

public class SQLDeleteElement extends ResultMapOperationElement {
	
	private ResultMapOperationElement operationElement;
	
	public SQLDeleteElement(ResultMapOperationElement operationElement) {
		this.operationElement = operationElement;
	}

	@Override
	protected String getPrefix() {
		return "\t\tdelete from " + operationElement.getHeader().getTableName() + " where \n\t\t";
	}

	@Override
	protected String getSuffix() {
		if (StringUtils.equals(this.operationElement.getOperation(), "deleteById")) {
			return new BaseDevElement(this.operationElement.getPrimaryKeyEqualValueElements(false)).build();
		}
		return null;
	}

	@Override
	protected List<DevElement> getChildren() {
		return null;
	}

}
